import * as minIO from "minio";

const minIOClient = new minIO.Client({
  endPoint: "frp.oss.cyue.net",
  port: 80, // 80 到 8080 到 9001
  useSSL: false,
  accessKey: "egqrRdLXF9qiKYF6UBxR",
  secretKey: "OTBa12D2BQ7RkcSEI7YkYLl9Q8C6f2dRn5invbNw",
});

const exportObject = {
  serverURL: "https://cdn.oss.cyue.net",
  put(objectName, stream) {
    return new Promise(async (resolve, reject) => {
      minIOClient.putObject("cyue-share", objectName, stream, (err, info) => {
        if (err) {
          console.error(err);
          reject(err);
        } else {
          resolve(info);
        }
      });
    });
  },
};
export default exportObject;
